package cn.tedu.boot31.boot21.controller;

import cn.tedu.boot31.boot21.entity.Person;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class ParamController {
    @RequestMapping("/param1")
    @ResponseBody
    public String param1(HttpServletRequest request) {
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        return name + ":" + age;
    }

    @RequestMapping("/param2")
    @ResponseBody
    public String param2(String name, int age) {
        return "第二种" + name + ":" + age;
    }

    @RequestMapping("/param3")
    @ResponseBody
    public String param3(Person person) {
        return person.toString();
    }

    ;
}